package ${(introspectedTable.tableConfiguration.properties.fileDirectoryMapper)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryMapper)?index_of("/src/main/java/")+15))?replace("/",".")};

import ${(introspectedTable.tableConfiguration.properties.fileDirectoryDO)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryDO)?index_of("/src/main/java/")+15))?replace("/",".")}.${className}DO;

import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.broker.framework.common.pojo.PageParam;
import com.broker.framework.common.pojo.PageResult;
import com.broker.framework.mybatis.core.mapper.BaseMapperX;
import com.broker.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.apache.ibatis.annotations.Mapper;

import java.util.*;

/***
 * ---------------------------
 * @Description: 表备注：${introspectedTable.remarks!}<#--deal null-->
 * 针对表【${introspectedTable.tableConfiguration.schema!}.${introspectedTable.fullyQualifiedTable.introspectedTableName}】的Mapper
 * ---------------------------
* @author: ${introspectedTable.tableConfiguration.properties.auther!}
* @date: ${introspectedTable.tableConfiguration.properties.createTime!}
 * @version: v1.0
 * ---------------------------
 */
@Mapper
public interface ${className}Mapper extends BaseMapperX<${className}DO> {

<#--    /**
     * *---------------------------
     * @Description: get by selector.
     * **---------------------------
     * @param selectorMap the selector map
     * @return trade payment bill do
     * ***---------------------------
     * @author: ${introspectedTable.tableConfiguration.properties.auther!}
     * @date: ${introspectedTable.tableConfiguration.properties.createTime!}
     * @version: v1.0
     * ****---------------------------
     */
    default ${className}DO getBySelector(Map<SFunction<${className}DO, ?>, Object> selectorMap) {
        if (selectorMap == null || selectorMap.isEmpty()) {
            //查全表另外写避免失误全表扫描
            return null;
        }

        LambdaQueryWrapperX<${className}DO> wrapper = new LambdaQueryWrapperX<>();
        selectorMap.forEach((dOSFunction, o) -> {
            if (o instanceof Collection){
                wrapper.in(dOSFunction, (Collection<?>) o);
            }else{
                wrapper.eq(dOSFunction, o);
            }
        });

        return selectOne(wrapper);
    }

    /**
     * *---------------------------
     * @Description: get list by selector.
     * **---------------------------
     * @param selectorMap the selector map
     * @return list
     * ***---------------------------
     * @author: ${introspectedTable.tableConfiguration.properties.auther!}
     * @date: ${introspectedTable.tableConfiguration.properties.createTime!}
     * @version: v1.0
     * ****---------------------------
     */
    default List<${className}DO> getListBySelector(Map<SFunction<${className}DO, ?>, Object> selectorMap) {
        if (selectorMap == null || selectorMap.isEmpty()) {
            //查全表另外写避免失误全表扫描
            return Collections.emptyList();
        }

        LambdaQueryWrapperX<${className}DO> wrapper = new LambdaQueryWrapperX<>();
        selectorMap.forEach((dOSFunction, o) -> {
            if (o instanceof Collection){
                wrapper.in(dOSFunction, (Collection<?>) o);
            }else{
                wrapper.eq(dOSFunction, o);
            }
        });

        wrapper.orderByDesc(${className}DO::getCreateTime);

        return selectList(wrapper);
    }

    /***
    * *---------------------------
    * @Description: count By Selector
    * **---------------------------
     * @param selectorMap
     * @return long
    * ***---------------------------
    * @author: ${introspectedTable.tableConfiguration.properties.auther!}
    * @date: ${introspectedTable.tableConfiguration.properties.createTime!}
    * @version: v1.0
    * ****---------------------------
    */
    default long countBySelector(Map<SFunction<${className}DO, ?>, Object> selectorMap) {
        if (selectorMap == null || selectorMap.isEmpty()) {
            //查全表另外写避免失误全表扫描
            return 0;
        }

        LambdaQueryWrapperX<${className}DO> wrapper = new LambdaQueryWrapperX<>();
        selectorMap.forEach((dOSFunction, o) -> {
            if (o instanceof Collection){
                wrapper.in(dOSFunction, (Collection<?>) o);
            }else{
                wrapper.eq(dOSFunction, o);
            }
        });

        return selectCount(wrapper);
    }

    /**
     * *---------------------------
     * @Description: get list page by selector.
     * **---------------------------
     * @param pageParam the page param
     * @param selectorMap the selector map
     * @return page result
     * ***---------------------------
     * @author: ${introspectedTable.tableConfiguration.properties.auther!}
     * @date: ${introspectedTable.tableConfiguration.properties.createTime!}
     * @version: v1.0
     * ****---------------------------
     */
    default PageResult<${className}DO> getListPageBySelector(PageParam pageParam, Map<SFunction<${className}DO, ?>, Object> selectorMap) {
        if (selectorMap == null || selectorMap.isEmpty()) {
            //查全表另外写避免失误全表扫描
            return PageResult.empty();
        }

        LambdaQueryWrapperX<${className}DO> wrapper = new LambdaQueryWrapperX<>();
        selectorMap.forEach((dOSFunction, o) -> {
            if (o instanceof Collection){
                wrapper.in(dOSFunction, (Collection<?>) o);
            }else{
                wrapper.eq(dOSFunction, o);
            }
        });

        wrapper.orderByDesc(${className}DO::getCreateTime);

        return selectPage(pageParam, wrapper);
    }-->

}